package listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebListener;

@WebListener
public class MyListener implements ServletContextListener , ServletRequestListener {
    public void contextInitialized(ServletContextEvent arg0) {
        System.out.println("对象创建");
    }
    public void contextDestroyed(ServletContextEvent arg0) {
        System.out.println("对象销毁");
    }

    @Override
    public void requestDestroyed(ServletRequestEvent servletRequestEvent) {
        System.out.println("ServletRequest创建");

    }

    @Override
    public void requestInitialized(ServletRequestEvent servletRequestEvent) {
        System.out.println("ServletRequest对象销毁");
    }
}
